package com.sunwayworld.basemodule.samplemanage.sample.resource.impl;

import com.sunwayworld.basemodule.samplemanage.sample.bean.LimsSampleBean;
import com.sunwayworld.framework.data.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.sunwayworld.basemodule.samplemanage.sample.resource.LimsSampleDerivativeResource;
import com.sunwayworld.basemodule.samplemanage.sample.service.LimsSampleDerivativeService;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;

@LogModule("衍生物关系表")
@RestController
@GikamBean
public class LimsSampleDerivativeResourceImpl implements LimsSampleDerivativeResource {

    @Autowired
    private LimsSampleDerivativeService limsSampleDerivativeService;

    @Override
    public LimsSampleDerivativeService getService() {
        return limsSampleDerivativeService;
    }

    @Log(value = "新增衍生物关系表", type = LogType.INSERT)
    @Override
    @RequestMapping(method = RequestMethod.POST)
    public Long insert(RestJsonWrapperBean wrapper) {
        return getService().insert(wrapper);
    }

    @Override
    @Log(value = "查询批次下所有衍生物", type = LogType.SELECT)
    public Page<LimsSampleBean> selectDerivativeInRunPagination(Long runId, RestJsonWrapperBean wrapperBean) {
        return getService().selectDerivativeInRunPagination(runId, wrapperBean);
    }

    @Log(value = "查询任务下所有衍生物", type = LogType.SELECT)
    @Override
    public Page<LimsSampleBean> selectDerivativeInTaskPagination(Long taskId, RestJsonWrapperBean wrapperBean) {
        return getService().selectDerivativeInTaskPagination(taskId, wrapperBean);
    }

    @Log(value = "添加衍生物", type = LogType.SELECT)
    @Override
    public void insertDerivative(RestJsonWrapperBean wrapper) {
        getService().insertDerivative(wrapper);
    }

    @Override
    public void insertDerivativesMulti(RestJsonWrapperBean wrapper) {
        getService().insertDerivativesMulti(wrapper);
    }

}
